<?php
    //Lay danh sach slide
    $content = array();
    $conds_default = $this->String->condsDefault();
    $conds_default = array_merge($conds_default,array('Node.node_type_id' => 1));
    $fields = $this->String->nodeFields();
    $order = $this->String->orderFields();
    $opt = array(
        'conditions' => $conds_default,
        'find' => 'all',
        'fields' => $fields,
        'locale' => true,
        'order' => array('Node.created' => 'asc')
    );
    $content = $this->String->get_data('Node','Node',$opt); 
    //debug($content);exit;
?>
<div class="flexslider flexslider-cal">
    <?php if(!empty($content)):?>
        <ul class="slides">
            <?php foreach($content as $key =>$values):?>
                <?php
                    if((!empty($values['Node']['field_image_default']))&&(file_exists(WWW_ROOT . '/img/' . $values['Node']['field_image_default'])))
                    {
                        if(!empty($values['Node']['field_description'])){
                            $thumb_pro = $this->Image->make_thumb($values['Node']['field_image_default'],WWW_ROOT . '/img/','979','293');
                        }else{
                            $thumb_pro = $values['Node']['field_image_default'];
                        }
                    }
                    else
                    {
                        $thumb_pro = $this->Image->make_thumb('no_image.jpg',WWW_ROOT.'/img/','979','293');
                    }
                ?> 
                <?php if(!empty($values['Node']['field_description'])):?>
                    <li>
                        <div class="banner-sld-content">
                            <div class="banner-item-left">
                                <h2 class="bn-title"><a class="" href="<?php echo $values['Node']['field_link_page']?>"><?php echo $values['Node']['title'];?></a></h2>
                                <p class="bn-desc"><?php echo String::truncate($values['Node']['field_description'],300);?></p>
                            </div>
                            <div class="banner-item-right"><a href="<?php echo $values['Node']['field_link_page']?>"><img src="<?php echo $this->Html->webroot('/img/' . $thumb_pro);?>" alt="banner" height="293" width="690"></a></div>
                        </div>
                    </li>
                <?php else:?>
                    <li>
                        <div class="banner-sld-content">
                            <div class="banner-item-right"><a href="<?php echo $values['Node']['field_link_page']?>"><img src="<?php echo $this->Html->webroot('/img/' . $thumb_pro);?>" alt="banner" style="height: 293px;width: auto;"></a></div>
                        </div>
                    </li>
                <?php endif;?>
                <?php endforeach;?>
        </ul>
        <?php endif;?>
</div>